import Vue from 'vue'
import VueRouter from 'vue-router'
import Reg from '../views/Reg/Reg.vue'
import Login from '../views/Login/Login.vue'
import Main from '../views/Main/Main.vue'
import Home from '../views/Menus/Home.vue'
import UserInfo from '../views/Menus/User/UserInfo.vue'
import UserAvatar from '../views/Menus/User/UserAvatar.vue'
import UserPwd from '../views/Menus/User/UserPwd.vue'
import ArtCate from '../views/Menus/Article/ArtCate.vue'
import ArtList from '../views/Menus/Article/ArtList.vue'


Vue.use(VueRouter)

const routes = [
  {
    path:'/reg',
    name:'reg', 
    component:Reg
  },
  {
    path:'/login',
    name:'login', 
    component:Login
  },
  {
    path:'/',
    name:'main', 
    component:Main,
    redirect:'home',
    children:[{
      path:'/home',
      name:'home', 
      component:Home
    },{
      path:'/user-info',
      name:'UserInfo', 
      component:UserInfo
    },{
      path:'user-avatar',
      name:'UserAvatar', 
      component:UserAvatar
    },{
      path:'user-pwd',
      name:'UserPwd', 
      component:UserPwd
    },{
      path:'art-cate',
      name:'ArtCate', 
      component:ArtCate
    },{
      path:'art-list',
      name:'ArtList', 
      component:ArtList
    },

  ]
  },
]

const router = new VueRouter({
  routes
})

const VueRouterPush=VueRouter.prototype.push
VueRouter.prototype.push = function push(to){
  return VueRouterPush.call(this,to).catch(err=>err)
}

export default router
